<template>
  <div class="title">
    <span class="back-icon" @click="goBack"
      ><van-icon name="arrow-left"
    /></span>
    <span class="title-text">{{ title }}</span>
  </div>
</template>

<script>
export default {
  data () {
    return {
    }
  },
  props: ['title'],
  methods: {
    goBack () {
      this.$router.go(-1)
    }
  }
}
</script>

<style lang="less">
.title {
  width: 100%;
  height: 45px;
  background-color: #f5f5f5;
  line-height: 45px;
  position: relative;
  margin-bottom: 10px;
  box-shadow: 2px 2px 1px #ccc;
}
.back-icon {
  width: 45px;
  line-height: 45px;
  text-align: center;
  position: absolute;
  z-index: 999;
}

.title-text {
  width: 100%;
  position: absolute;
  text-align: center;
}
</style>
